﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Model
{
    public interface ITextMeasurer
    {
        SizeF MeasureString(string text, Font font);
    }

    public class TextMeasurer : ITextMeasurer
    {
        private readonly Image _fakeImage;
        private readonly Graphics _graphics;
        public TextMeasurer()
        {
            _fakeImage = new Bitmap(1, 1);
            _graphics = Graphics.FromImage(_fakeImage);
        }

        public SizeF MeasureString(string text, Font font)
        {
            return _graphics.MeasureString(text, font);
        }
    }
}
